<%-- 
    Document   : CadastrarCategorias
    Created on : 15/09/2008, 15:40:21
    Author     : 2006244090114
--%>
<%@page import="java.util.*,persistencia.*, modelo.*"contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Cadastrar Categorias</title>
     <link rel="stylesheet" href="gastozero.css" type="text/css">
   </head>
<body  class="body" background="imagemDeFundo.jpg">
<center> <font size="3" face="arial" > <h1>Gasto Zero</h1></font></center><br/><br/><br/>
<center>
                <h3>CONFIGURAC&Atilde;O DAS CATEGORIAS</h3>
            </center><br/>
                
                
<div class="style1" >    
    <center>
        
        <font ><a href="Menu.jsp" class="texto" >MENU</a></font>&nbsp;&nbsp;&nbsp;&nbsp;
        <font  class="texto"><a class="texto"  href="ServletCategoria?acao=listar">EDITAR</a></font>&nbsp;&nbsp;&nbsp;&nbsp;
        <font  class="texto"><a class="texto"  href="index.jsp">SAIR >></a></font>&nbsp;&nbsp;&nbsp;&nbsp;        
    </center>
</div>
            <div class="style3">
            
                <center><br/>   
                
              <%
                    CategoriaDAO categoriaDAO = new CategoriaDAO();
                    Vector categorias =  categoriaDAO.getCategorias();
                %>
       LISTA DAS CATEGORIAS EXISTENTES: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="categoria">
   <%

            Iterator it = categorias.iterator();
            while (it.hasNext()) {

                Categoria cat = (Categoria) it.next();
                out.println("<option value=" + cat.getId_categoria() + ">" + cat.getNome_categoria() + "</option>");
            }
    %>   
    <c:forEach var="categoria"  items="${categorias}">
         <option value="${categoria.id_categoria}">
            ${categoria} 
        </option>
    </c:forEach>    
</select>

<form action="ServletCategoria?acao=salvar" method="POST">     
    <h4>Nova Categoria:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="nome_categoria" value="" />
    <input type="submit" value="Salvar" /></h4>
    <br/>
    ${msg}
</form>
</center>
</div>
     </body>
</html>
